<%@ page language="java" import="java.util.*,java.text.*,java.io.*" pageEncoding="utf-8"%>
<%@page import="issuedfileaction.DBConnection;"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>放弃文件</title>
    
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
<%
	  String IssuedFile=request.getParameter("Renouncefile");
	  IssuedFile=new String(IssuedFile.getBytes("ISO-8859-1"),"utf-8");  
	  String[] IssuedFileArray=IssuedFile.trim().split("@@");	    
      String SQLStr="";
      DBConnection DB=new DBConnection();      
	  for(int i=0;i<IssuedFileArray.length;i++){
	      String[] splitarr=IssuedFileArray[i].split("!!");
	      File FileSource=new File(splitarr[0]); 
	      String FileFoldType=DB.SQLExec("select dt_mdealtype from dtmonitor where dt_mid='"+splitarr[1].trim()+"' ");     
	      if((FileFoldType.equals("1")) || (FileFoldType.equals("3")) || (FileFoldType.equals("2"))){
			 if(!splitarr[2].trim().equals("4")){
				SQLStr="update dtmonitor set dt_mfiletype='5' where dt_mid='"+splitarr[1].trim()+"' ";									  
			 }
	      }else if((FileFoldType.equals("4"))){
			 if(!splitarr[2].trim().equals("6")){
				SQLStr="update dtmonitor set dt_mfiletype='7' where dt_mid='"+splitarr[1].trim()+"' ";									   
			 }
	      }
	      DB.UpdateExec(SQLStr);	      
	  }	  
	 HttpSession httpSession = request.getSession();          
     List<Object> ListRows = new ArrayList<Object>();
     SQLStr=httpSession.getAttribute("ReturnSQL").toString();
     ListRows=DB.SQLListExec(SQLStr);
     httpSession.setAttribute("filelist", ListRows);	
	 httpSession.setAttribute("beginDate", httpSession.getAttribute("beginDate").toString());
	 httpSession.setAttribute("endDate", httpSession.getAttribute("endDate").toString());
	 httpSession.setAttribute("dealercode", httpSession.getAttribute("dealercode").toString());
	 httpSession.setAttribute("dealername", httpSession.getAttribute("dealername").toString());	 
	 httpSession.setAttribute("filetype", httpSession.getAttribute("filetype").toString());
	 httpSession.setAttribute("ReturnSQL", SQLStr);
	 httpSession.setAttribute("alertvalue", "文件放弃成功!");			 	    	       
     response.sendRedirect("CheckIssue.jsp"); 
    %>
  </body>
</html>
